import java.util.Scanner;

/**
 * @author ShenTuZhiGang
 * @version 1.0.0
 * @email 1600337300@qq.com
 * @date 2021-08-22 20:50
 */
public class ExamTencent2021082204 {
    static String s0;
    static String ans = "";

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        scanner.nextLine();
        s0 = scanner.nextLine();
        dfs(s0, "", k);
        System.out.println(ans);
    }

    public static void dfs(String s, String t, int k) {
        if (t.length() == k && ans.compareTo(t) < 0) {
            ans = t;
            return;
        }
        if (s.length() == 0 || t.length() > k) {
            return;
        }
        if (t.length() + s.length() < k) {
            return;
        }
        dfs(s.substring(1), t + s.charAt(0), k);
        dfs(s.substring(1), t, k);
    }
}
